namespace FluentMvc.Test.Models
{
    using System;

    public class UserProfile : IModelInitializer<UserProfile>
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public int Age { get; set; }
        public string Email { get; set; }
        public string Website { get; set; }
        public DateTime? BirthDate { get; set; }

        public void InitializeModel(ModelContext<UserProfile> context)
        {
            context.RulesFor(userProfile => userProfile.Age)
                .Range(15, 120, c => c.Message("Age range must between 15 and 120"));
            context.RulesFor(userProfile => userProfile.Email)
                .Required(c => c.Message("Email is required"))
                .Email(c => c.Message("Email format is not currect."));
            context.RulesFor(userProfile => userProfile.Website)
                .Url(c => c.Message("Website format is not currect."));
        }
    }
}